package com.fancy.learncenter.utils;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.andview.refreshview.XRefreshView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.CartoonAnswerKeysBean;
import com.fancy.learncenter.bean.CartoonAnswersBean;
import com.fancy.learncenter.bean.CartoonFillBlankBean;
import com.fancy.learncenter.bean.CartoonMediaBean;
import com.fancy.learncenter.bean.CartoonOptionsBean;
import com.fancy.learncenter.bean.CartoonStemsBean;
import com.fancy.learncenter.bean.CartoonTextsBean;
import com.fancy.learncenter.bean.QuestionVOsBean;
import com.fancy.learncenter.common.JumpIntentKey;
import com.fancy.learncenter.ui.adapter.CartoonQuestionTextOptionAdapter;
import com.fancy.learncenter.ui.adapter.CartoonTeacherQuestionImageAdapter;
import com.fancy.learncenter.ui.adapter.CustomTagAdapter;
import com.fancy.learncenter.ui.adapter.EnglishSentenceAdapter;
import com.fancy.learncenter.ui.adapter.GridViewAdapter;
import com.fancy.learncenter.ui.adapter.PreviewHomeworkAdapter;
import com.fancy.learncenter.ui.callback.AlbumImpl;
import com.fancy.learncenter.ui.fragment.GrammarChooseFillBlankFragment;
import com.fancy.learncenter.ui.view.GridSpacingItemDecoration;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import com.zhy.view.flowlayout.TagFlowLayout;
import com.zhy.view.flowlayout.TagView;

import java.util.ArrayList;
import java.util.List;

import static com.fancy.learncenter.common.JumpIntentKey.OPTION_STATUS.STATUS_CHOOSE;
import static com.fancy.learncenter.common.JumpIntentKey.OPTION_STATUS.STATUS_DEFAULT;
import static com.fancy.learncenter.common.JumpIntentKey.OPTION_STATUS.STATUS_RIGHT;
import static com.fancy.learncenter.common.JumpIntentKey.OPTION_STATUS.STATUS_WORD;

/**
 * Created by shiweiwei on 2018/1/31.
 */

public class TeacherWorkPreviewDataUtil {

    /**
     * 听音选择
     *
     * @param item
     * @param question_name
     * @param voice_image
     * @param recyclerView
     * @param see_answer_layout
     */
    public static void LCTP_DataUtils(final PreviewHomeworkAdapter previewHomeworkAdapter, Context mContext, final QuestionVOsBean item, TextView question_name, final ImageView voice_image, RecyclerView recyclerView, final TextView see_answer_layout) {

        final List<CartoonMediaBean> images = item.getOptions().getImages();
        String questionNameStr;
        String audioUrl = null;
        String standardAnswerId = null;
        CartoonAnswerKeysBean answerKeysBean = item.getAnswerKeys();
        JumpIntentKey.QUESTION_ENTER_TYPE type = JumpIntentKey.QUESTION_ENTER_TYPE.NO_CLICK;

        CartoonStemsBean stemsBean = item.getStems();
        if (stemsBean != null) {
            List<CartoonTextsBean> textsBeanList = stemsBean.getTexts();
            if (textsBeanList != null && textsBeanList.size() > 0) {
                questionNameStr = textsBeanList.get(0).getValue();
                if (!TextUtils.isEmpty(questionNameStr)) {
                    question_name.setText(questionNameStr);
                    question_name.setVisibility(View.VISIBLE);
                } else {
                    question_name.setVisibility(View.GONE);
                }
            } else {
                question_name.setVisibility(View.GONE);
            }
        }

        List<CartoonMediaBean> audioList = item.getStems().getAudios();
        if (audioList != null && audioList.size() > 0) {
            audioUrl = audioList.get(0).getPlayLink();
            if (!TextUtils.isEmpty(audioUrl)) {
                voice_image.setVisibility(View.VISIBLE);
            } else {
                voice_image.setVisibility(View.GONE);
            }
        }


        List<CartoonTextsBean> answerList = item.getAnswers().getTexts();
        if (answerList != null && answerList.size() > 0) {

            if (!TextUtils.isEmpty(answerList.get(0).getValue())) {
                standardAnswerId = answerList.get(0).getValue();
            }
        }

        final String finalAudioUrl = audioUrl;

        voice_image.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Utils.playOrPauseAudio(previewHomeworkAdapter, finalAudioUrl, voice_image);
            }
        });


        GridLayoutManager manager = new GridLayoutManager(mContext, 2);
        manager.setOrientation(GridLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(manager);
        final CartoonTeacherQuestionImageAdapter adapter = new CartoonTeacherQuestionImageAdapter(mContext, type, images);
        recyclerView.setAdapter(adapter);
        final String finalStandardAnswerId = standardAnswerId;
        see_answer_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (item.getIsChecked()) {
                    case 0:
                        item.setIsChecked(1);
                        for (CartoonMediaBean bean : images) {
                            if (String.valueOf(finalStandardAnswerId).equals(String.valueOf(bean.getId()))) {
                                bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_RIGHT);
                                break;
                            }
                        }
                        see_answer_layout.setText("查看原题");
                        adapter.notifyDataSetChanged();
                        break;
                    case 1:
                        item.setIsChecked(0);
                        for (CartoonMediaBean bean : images) {
                            bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_DEFAULT);
                        }
                        see_answer_layout.setText("查看答案");
                        adapter.notifyDataSetChanged();
                        break;
                }
            }
        });

        switch (item.getIsChecked()) {
            case 1:
                for (CartoonMediaBean bean : images) {
                    if (String.valueOf(finalStandardAnswerId).equals(String.valueOf(bean.getId()))) {
                        bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_RIGHT);
                        break;
                    }
                }
                see_answer_layout.setText("查看原题");
                adapter.notifyDataSetChanged();
                break;
            case 0:
                for (CartoonMediaBean bean : images) {
                    bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_DEFAULT);
                }
                see_answer_layout.setText("查看答案");
                adapter.notifyDataSetChanged();
                break;
        }


    }

    /**
     * 看词拼图
     *
     * @param mContext
     * @param question_name
     * @param gridView
     * @param see_answer_layout
     */
    public static void LPTPT_DataUtils(Context mContext, final QuestionVOsBean questionVOsBean, final TextView question_name, GridView gridView, final TextView see_answer_layout) {

        final List<CartoonMediaBean> list = new ArrayList<>();
        final List<CartoonMediaBean> orginalList = new ArrayList<>();
        List<String> standardAnswerStrList = new ArrayList<>();
        final List<CartoonMediaBean> standardAnswerList = new ArrayList<>();
        if (questionVOsBean != null) {
            CartoonOptionsBean optionsBean = questionVOsBean.getOptions();
            CartoonAnswersBean answersBean = questionVOsBean.getAnswers();
            CartoonStemsBean stemsBean = questionVOsBean.getStems();
            List<CartoonTextsBean> textsList = stemsBean.getTexts();
            if (textsList != null && textsList.size() > 0) {
                String questionNameStr = textsList.get(0).getValue();
                if (!TextUtils.isEmpty(questionNameStr)) {
                    question_name.setText(questionNameStr);
                }
            }

            if (optionsBean != null) {
                list.addAll(optionsBean.getImages());
                for (CartoonMediaBean bean : list) {
                    CartoonMediaBean orginalBean = new CartoonMediaBean();
                    orginalBean.setStatus(bean.getStatus());
                    orginalBean.setId(bean.getId());
                    orginalBean.setImgUrl(bean.getImgUrl());
                    orginalBean.setPlayLink(bean.getPlayLink());
                    orginalBean.setResourceName(bean.getResourceName());
                    orginalBean.setType(bean.getType());
                    orginalList.add(orginalBean);
                }
            }

            final GridViewAdapter adapter = new GridViewAdapter(mContext, list);
            gridView.setAdapter(adapter);

            if (answersBean != null) {
                for (int i = 0; i < answersBean.getTexts().size(); i++) {
                    standardAnswerStrList.add(answersBean.getTexts().get(i).getValue());
                }
            }

            if (list.size() == standardAnswerStrList.size()) {

                for (String str : standardAnswerStrList) {
                    for (CartoonMediaBean bean : list) {
                        if (String.valueOf(bean.getId()).equals(str)) {
                            standardAnswerList.add(bean);
                            break;
                        }
                    }
                }
            }

            switch (questionVOsBean.getIsChecked()) {
                case 0:
                    list.clear();
                    list.addAll(orginalList);
                    adapter.notifyDataSetChanged();
                    see_answer_layout.setText("查看答案");
                    break;
                case 1:
                    list.clear();
                    list.addAll(standardAnswerList);
                    adapter.notifyDataSetChanged();
                    see_answer_layout.setText("查看原题");
                    break;
            }

            see_answer_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    switch (questionVOsBean.getIsChecked()) {
                        case 0:
                            questionVOsBean.setIsChecked(1);
                            list.clear();
                            list.addAll(standardAnswerList);
                            adapter.notifyDataSetChanged();
                            see_answer_layout.setText("查看原题");
                            break;
                        case 1:
                            questionVOsBean.setIsChecked(0);
                            list.clear();
                            list.addAll(orginalList);
                            adapter.notifyDataSetChanged();
                            see_answer_layout.setText("查看答案");
                            break;
                    }

                }
            });
        }
    }

    /**
     * 看图选词
     *
     * @param mContext
     * @param questionVOsBean
     * @param see_answer_layout
     * @param recyclerView
     */

    public static void LCTW_DataUtils(Context mContext, final QuestionVOsBean questionVOsBean, final SimpleDraweeView question_image, final TextView see_answer_layout, RecyclerView recyclerView) {

        if (questionVOsBean != null) {
            CartoonOptionsBean optionsBean = questionVOsBean.getOptions();
            final List<CartoonTextsBean> textsList = new ArrayList<>();
            String standardAnswerStr = "";
            String imageUrl;
            if (optionsBean != null) {
                textsList.addAll(optionsBean.getTexts());
            }

            CartoonAnswersBean answersBean = questionVOsBean.getAnswers();
            if (answersBean != null) {
                standardAnswerStr = answersBean.getTexts().get(0).getValue();
            }

            CartoonStemsBean stemsBean = questionVOsBean.getStems();
            List<CartoonMediaBean> imageList = stemsBean.getImages();
            if (imageList != null && imageList.size() > 0) {
                imageUrl = imageList.get(0).getImgUrl();
                if (!TextUtils.isEmpty(imageUrl)) {
                    question_image.setVisibility(View.VISIBLE);
                    question_image.setImageURI(imageUrl);
                } else {
                    question_image.setVisibility(View.GONE);
                }
            }

            LinearLayoutManager manager = new LinearLayoutManager(mContext);
            manager.setOrientation(LinearLayoutManager.VERTICAL);
            JumpIntentKey.QUESTION_ENTER_TYPE type = JumpIntentKey.QUESTION_ENTER_TYPE.TEACHER_WORK_PREVIEW;
            final CartoonQuestionTextOptionAdapter adapter = new CartoonQuestionTextOptionAdapter(mContext, type, textsList);
            recyclerView.setLayoutManager(manager);
            recyclerView.setAdapter(adapter);
            switch (questionVOsBean.getIsChecked()) {
                case 0:
                    for (CartoonTextsBean bean : textsList) {
                        bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_DEFAULT);
                    }
                    adapter.notifyDataSetChanged();
                    see_answer_layout.setText("查看答案");
                    break;
                case 1:
                    for (CartoonTextsBean bean : textsList) {
                        if (standardAnswerStr.equals(bean.getValue())) {
                            bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_RIGHT);
                            break;
                        }
                    }
                    adapter.notifyDataSetChanged();
                    see_answer_layout.setText("查看原题");
                    break;
            }

            final String finalStandardAnswerStr = standardAnswerStr;
            see_answer_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    switch (questionVOsBean.getIsChecked()) {
                        case 0:
                            questionVOsBean.setIsChecked(1);
                            for (CartoonTextsBean bean : textsList) {
                                if (finalStandardAnswerStr.equals(bean.getValue())) {
                                    bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_RIGHT);
                                    break;
                                }
                            }
                            adapter.notifyDataSetChanged();
                            see_answer_layout.setText("查看原题");
                            break;
                        case 1:
                            questionVOsBean.setIsChecked(0);
                            for (CartoonTextsBean bean : textsList) {
                                bean.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_DEFAULT);
                            }
                            adapter.notifyDataSetChanged();
                            see_answer_layout.setText("查看答案");
                            break;
                    }

                }
            });

        }
    }

    /**
     * 听音拼接
     */
    public static void LLAS_DataUtils(final PreviewHomeworkAdapter previewHomeworkAdapter, Context mContext, final QuestionVOsBean questionVOsBean, final ImageView voice_image, SimpleDraweeView questionImage, TagFlowLayout flowlayout, final TextView see_answer_layout) {
        CartoonStemsBean stemsBean = questionVOsBean.getStems();
        String imageUrl = "";
        String audioStr = "";
        String questionStr = "";
        final List<String> standardAnswerList;
        final List<String> orginalAnswerList = new ArrayList<>();
        if (stemsBean != null) {
            List<CartoonTextsBean> textsBeans = stemsBean.getTexts();
            List<CartoonMediaBean> imageBeans = stemsBean.getImages();
            List<CartoonMediaBean> audioBean = stemsBean.getAudios();
            imageUrl = imageBeans.get(0).getImgUrl();
            audioStr = audioBean.get(0).getPlayLink();

            questionStr = textsBeans.get(0).getValue();
        }

        if (!TextUtils.isEmpty(audioStr)){
            voice_image.setVisibility(View.VISIBLE);
        }else {
            voice_image.setVisibility(View.GONE);
        }

        final String finalAudioStr = audioStr;
        voice_image.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Utils.playOrPauseAudio(previewHomeworkAdapter, finalAudioStr, voice_image);
            }
        });

        CartoonAnswersBean answersBean = questionVOsBean.getAnswers();
        standardAnswerList = new ArrayList<String>();
        if (answersBean != null) {
            List<CartoonTextsBean> textsBeanList = answersBean.getTexts();
            if (textsBeanList != null) {
                for (int i = 0; i < textsBeanList.size(); i++) {
                    CartoonTextsBean textsBean = textsBeanList.get(i);
                    standardAnswerList.add(textsBean.getValue());
                    orginalAnswerList.add(textsBean.getValue());
                }
            }
        }
        if (!TextUtils.isEmpty(imageUrl)) {
            questionImage.setImageURI(imageUrl);
            questionImage.setVisibility(View.VISIBLE);
        } else {
            questionImage.setVisibility(View.GONE);
        }
        String[] strArray = questionStr.split(" ");
        final List<CartoonFillBlankBean> blankList = new ArrayList<>();
        for (int i = 0; i < strArray.length; i++) {

            CartoonFillBlankBean blankBean = new CartoonFillBlankBean();
            blankBean.setStatus(STATUS_DEFAULT);
            blankBean.setValue(strArray[i]);
            CartoonFillBlankBean blankBean2 = new CartoonFillBlankBean();
            blankBean2.setStatus(STATUS_DEFAULT);
            blankBean2.setValue(" ");
            blankList.add(blankBean);
            blankList.add(blankBean2);
        }
        final JumpIntentKey.QUESTION_ENTER_TYPE type = JumpIntentKey.QUESTION_ENTER_TYPE.TEACHER_WORK_PREVIEW;
        final CustomTagAdapter tagAdapter = new CustomTagAdapter(mContext, blankList, type);
        flowlayout.setAdapter(tagAdapter);

        flowlayout.setOnTagClickListener(new TagFlowLayout.OnTagClickListener() {
            @Override
            public boolean onTagClick(View view, int position, FlowLayout parent) {
                return true;
            }
        });

        switch (questionVOsBean.getIsChecked()){
            case 0:
                see_answer_layout.setText("查看答案");
                standardAnswerList.clear();
                standardAnswerList.addAll(orginalAnswerList);
                for (CartoonFillBlankBean bean: blankList){
                    bean.setOptionValue("");
                    bean.setStatus(STATUS_DEFAULT);
                }
                tagAdapter.notifyDataChanged();

                break;

            case 1:
                see_answer_layout.setText("查看题目");
                for (int i = 0; i < blankList.size(); i++){

                    if ("##".equals(blankList.get(i).getValue())){
                        if (standardAnswerList != null && standardAnswerList.size() > 0) {
                            blankList.get(i).setOptionValue(standardAnswerList.get(0));
                            blankList.get(i).setStatus(STATUS_RIGHT);
                            standardAnswerList.remove(0);
                        }
                    }
                }
                tagAdapter.notifyDataChanged();

                break;
        }

        see_answer_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                switch (questionVOsBean.getIsChecked()){
                    case 0:
                        questionVOsBean.setIsChecked(1);
                        see_answer_layout.setText("查看题目");
                        for (int i = 0; i < blankList.size(); i++){

                            if ("##".equals(blankList.get(i).getValue())){
                                if (standardAnswerList != null && standardAnswerList.size() > 0) {
                                    blankList.get(i).setOptionValue(standardAnswerList.get(0));
                                    blankList.get(i).setStatus(STATUS_RIGHT);
                                    standardAnswerList.remove(0);
                                }
                            }
                        }
                        tagAdapter.notifyDataChanged();

                        break;
                    case 1:
                        questionVOsBean.setIsChecked(0);
                        see_answer_layout.setText("查看答案");
                        standardAnswerList.clear();
                        standardAnswerList.addAll(orginalAnswerList);
                        for (CartoonFillBlankBean bean: blankList){
                            bean.setOptionValue("");
                            bean.setStatus(STATUS_DEFAULT);
                        }
                        tagAdapter.notifyDataChanged();
                        break;
                }
            }
        });
    }


    private void USFB_DataUtils(final Context mContext, QuestionVOsBean questionVOsBean, XRefreshView xRefreshView, RecyclerView recyclerView){

        if (questionVOsBean == null){
            return;
        }

        xRefreshView.setPullRefreshEnable(false);

        View headView = LayoutInflater.from(mContext).inflate(R.layout.word_see_image_listen_spell_head_view, null);
        TextView questionText = (TextView) headView.findViewById(R.id.question_name);
        SimpleDraweeView questionImage = (SimpleDraweeView) headView.findViewById(R.id.question_image);
        ImageView voice_image = (ImageView) headView.findViewById(R.id.voice_image);
        final TagFlowLayout flowLayout = (TagFlowLayout) headView.findViewById(R.id.flowlayout);
        View invisibleView = headView.findViewById(R.id.invisible_view);
        invisibleView.setVisibility(View.GONE);



        CartoonOptionsBean optionsBean = questionVOsBean.getOptions();
        CartoonStemsBean stemsBean = questionVOsBean.getStems();
        CartoonAnswersBean answersBean = questionVOsBean.getAnswers();
        List<CartoonTextsBean> answersList = new ArrayList<>();
        List<String> standardAnswerList = new ArrayList<>();
        List<CartoonFillBlankBean> importAnswerList = new ArrayList<>();
        final List<CartoonTextsBean> optionsTextList = new ArrayList<>();
        String audioUrl = "";
        String questionStr = "";

        if (answersBean != null) {
            answersList.addAll(answersBean.getTexts());
            for (CartoonTextsBean textsBean : answersList) {
                standardAnswerList.add(textsBean.getValue());
                CartoonFillBlankBean bean = new CartoonFillBlankBean();
                bean.setOptionValue(textsBean.getValue());
                bean.setId(String.valueOf(textsBean.getId()));
                importAnswerList.add(bean);
            }
        }
        JumpIntentKey.QUESTION_ENTER_TYPE type = JumpIntentKey.QUESTION_ENTER_TYPE.TEACHER_WORK_PREVIEW;
        GridSpacingItemDecoration decoration = new GridSpacingItemDecoration(2, 40, true, true);
        final EnglishSentenceAdapter adapter = new EnglishSentenceAdapter(mContext, optionsTextList, type);
        GridLayoutManager manager = new GridLayoutManager(mContext, 2);
        manager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(manager);
        recyclerView.addItemDecoration(decoration);
        recyclerView.setAdapter(adapter);
        adapter.setHeaderView(headView, recyclerView);

        if (optionsBean != null) {
            optionsTextList.addAll(optionsBean.getTexts());
            adapter.notifyDataSetChanged();
        }

        if (stemsBean != null) {
            List<CartoonMediaBean> audioList = stemsBean.getAudios();
            if (audioList != null && audioList.size() > 0) {
                audioUrl = audioList.get(0).getPlayLink();
                voice_image.setVisibility(View.VISIBLE);
            } else {
                voice_image.setVisibility(View.GONE);
            }

            List<CartoonMediaBean> imageList = stemsBean.getImages();
            if (imageList != null && imageList.size() > 0) {
                questionImage.setImageURI(imageList.get(0).getImgUrl());
                questionImage.setVisibility(View.VISIBLE);
            } else {
                questionImage.setVisibility(View.GONE);
            }

            questionStr = stemsBean.getTexts().get(0).getValue();
        }

       List<CartoonFillBlankBean> blankList = new ArrayList<>();
        String[] questionNameList = questionStr.split(" ");
        for (int i = 0; i < questionNameList.length; i++) {

            CartoonFillBlankBean blankBean = new CartoonFillBlankBean();
            blankBean.setStatus(STATUS_DEFAULT);
            blankBean.setValue(questionNameList[i]);
            CartoonFillBlankBean blankBean2 = new CartoonFillBlankBean();
            blankBean2.setStatus(STATUS_DEFAULT);
            blankBean2.setValue(" ");
//            blankBean.setValue(String.valueOf(questionStr.charAt(i)));
            blankList.add(blankBean);
            blankList.add(blankBean2);
        }




        /**
         * 填充
         */
        class FillBlankAdapter extends TagAdapter<CartoonFillBlankBean> {

            public FillBlankAdapter(List<CartoonFillBlankBean> datas) {
                super(datas);
            }

            @Override
            public View getView(FlowLayout parent, int position, CartoonFillBlankBean cartoonFillBlankBean) {
                LinearLayout view = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.sentence_question_name_layout, flowLayout, false);
                final TextView question = (TextView) view.findViewById(R.id.question_letter);


                if ("##".equals(cartoonFillBlankBean.getValue())) {

                    switch (cartoonFillBlankBean.getStatus()) {
                        case STATUS_DEFAULT:

                            /**---将隐藏的选项显示出来------**/
                            for (int i = 0; i < optionsTextList.size(); i++) {
                                if (String.valueOf(optionsTextList.get(i).getId()).equals(cartoonFillBlankBean.getId())) {
                                    optionsTextList.get(i).setHidden(0);
                                    optionsTextList.get(i).setStatus(null);
                                    cartoonFillBlankBean.setOptionValue("");
                                    cartoonFillBlankBean.setId("");

                                }
                            }
                            if (adapter != null) {
                                adapter.notifyDataSetChanged();
                            }
                            question.setText("");
                            question.setBackgroundResource(R.mipmap.cartoon_sentence_transparent_doted);
                            break;
                        case STATUS_CHOOSE:
                            question.setText("");
                            question.setBackgroundResource(R.mipmap.cartoon_sentence_white_dotted);
                            break;
                        case STATUS_WORD:
                            if (!TextUtils.isEmpty(cartoonFillBlankBean.getOptionValue())) {
                                question.setText(cartoonFillBlankBean.getOptionValue());
                            }
                            /**---隐藏选项------**/
                            for (int i = 0; i < optionsTextList.size(); i++) {
                                if (String.valueOf(optionsTextList.get(i).getId()).equals(cartoonFillBlankBean.getId())) {
                                    optionsTextList.get(i).setHidden(1);
//                                optionsTextList.get(i).setValue("");
                                }
                            }

                            if (adapter != null) {
                                adapter.notifyDataSetChanged();
                            }

                            question.setBackgroundResource(R.mipmap.cartoon_sentence_white_dotted);
                            break;

                        case STATUS_WRONG:
                            if (!TextUtils.isEmpty(cartoonFillBlankBean.getOptionValue())) {
                                question.setText(cartoonFillBlankBean.getOptionValue());
                                question.setBackgroundResource(R.mipmap.cartoon_word_long_wrong);
                            }
                            break;

                        case STATUS_RIGHT:
                            if (!TextUtils.isEmpty(cartoonFillBlankBean.getOptionValue())) {
                                question.setText(cartoonFillBlankBean.getOptionValue());
                                question.setBackgroundResource(R.mipmap.cartoon_word_long_right);
                            }
                            break;
                    }

                } else {
                    question.setText(cartoonFillBlankBean.getValue());
                    question.setBackground(null);
                }


                return view;
            }
        }


    }



}
